> ## Documentation Index
> Fetch the complete documentation index at: https://sequence-0fb8d9e6-api_docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Unity SDK Setup for Embedded Wallets

> Documentation for Unity SDK setup for the Sequence infrastructure stack for web3 gaming.

<Steps>
  <Step title="Configure your Builder Project">
    [Configure your Embedded Wallet](/sdk/headless-wallet/quickstart) in the Sequence Builder
  </Step>

  <Step title="Install the Unity SDK">
    Install the latest version of Sequence's Unity SDK from [OpenUPM](/sdk/unity/installation#openupm),
    or use [Unity's Package Manager UI](/sdk/unity/installation#or-using-package-manager-ui)
    and use the following Git URL `https://github.com/0xsequence/sequence-unity.git?path=/Packages/Sequence-Unity`
  </Step>

  <Step title="Configure the SDK">
    Sign in and create a project on [Sequence Builder](https://sequence.build).

    Download your config file from Builder as shown below.

    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-api_docs/CmKz04BVDGuy1x-Z/images/unity/builder_config_file.png?fit=max&auto=format&n=CmKz04BVDGuy1x-Z&q=85&s=76b2a923d7ab4fb255de73f520c2b939" width="1696" height="1450" data-path="images/unity/builder_config_file.png" />
    </Frame>

    Place this file in the root of a `Resources` folder.
  </Step>

  <Step title="Integrate your Login Process">
    Start by checking if a wallet session is available from storage:

    ```csharp theme={null}
    bool recovered = await EmbeddedWalletAdapter.GetInstance().TryRecoverWalletFromStorage();
    ```

    If that returns `false` you should ask the user to sign. Import the `Setup` Sample from the Package Manager UI
    which will place a set of boilerplates into your project in a `Resources/` directory.
    Create the [Login Boilerplate](/sdk/unity/bootstrap) to send a one-time password to the specified email address.

    Once you’ve your first features integrated, you can continue with [additional login providers](/sdk/unity/wallets/embedded-wallet/onboard/authentication/intro)
    such as Google, Apple, or PlayFab.

    ```csharp theme={null}
    BoilerplateFactory.OpenSequenceLoginWindow(parent);
    ```

    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-api_docs/CmKz04BVDGuy1x-Z/images/unity/unity_boilerplate_login.png?fit=max&auto=format&n=CmKz04BVDGuy1x-Z&q=85&s=d418b0f515191114c6c94eecd1795d40" width="1144" height="500" data-path="images/unity/unity_boilerplate_login.png" />
    </Frame>
  </Step>

  <Step title="Test Sequence's Features">
    Sequence's Unity SDK includes a variety of [Boilerplates](/sdk/unity/bootstrap) to help you quickly start your game.
    Once everything is configured, you can create prefabs to display an Player Profile, Inventory, or In-Game Shop.
    Checkout [how to integrate a Player Profile.](/sdk/unity/bootstrap)

    ```csharp theme={null}
    BoilerplateFactory.OpenSequencePlayerProfile(parent, wallet, chain);
    ```

    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-api_docs/CmKz04BVDGuy1x-Z/images/unity/unity_boilerplate_profile.png?fit=max&auto=format&n=CmKz04BVDGuy1x-Z&q=85&s=a13bc5b869a2c754efd848cc9ef75ead" width="1144" height="500" data-path="images/unity/unity_boilerplate_profile.png" />
    </Frame>
  </Step>

  <Step title="Integrate it on your own">
    Start with the `EmbeddedWalletAdapter` to quickstart your integration with a few one-liners and you are ready to go.
    When you want to customize your integration, checkout our other docs such as [authenticating users](/sdk/unity/wallets/embedded-wallet/onboard/authentication/intro) or [how to send transactions.](/sdk/unity/wallets/embedded-wallet/blockchain-interactions)

    ```csharp theme={null}
    EmbeddedWalletAdapter adapter = EmbeddedWalletAdapter.GetInstance();

    // Recover your wallet from storage
    bool recovered = await adapter.TryRecoverWalletFromStorage();

    // Otherwise, create a new session via Google Sign-In
    bool successful = await adapter.GoogleLogin();

    // Next, let's send a transaction
    string recipientAddress = "0xabc123..";
    string currencyAddress = "0xabc123..";
    BigInteger amount = 1000;

    await adapter.SendToken(recipientAddress, amount, currencyAddress);
    ```
  </Step>
</Steps>

## Configuration Parameters

`Url Scheme` - You must replace this with a string that is unique to your application. This is very important. Failure to do so will cause unexpected behaviour when signing in with social sign in and it will not work.

`StoreSessionPrivateKeyInSecureStorage` - Available on select platforms: we have integrated with the platform's native secure storage system. If enabled, we will store session wallet info (including the private key) in secure storage and automatically attempt to recover the session for the user after closing the app (so they won't need to login again). With this disabled (default) or on an unsupported platform, the session wallet's private keys never leave the application's runtime memory; however, your user will need to sign in again anytime they close the app. The default `SequenceLoginWindow` Boilerplate (see [Bootstrap your Game](/sdk/unity/bootstrap)) will handle this behaviour for you automatically, navigating to the appropriate page.

`EnableMultipleAccountsPerEmail` - By default, the SDK will only allow users to create one account per email. The account is initially associated with the login method used (email + OTP, PlayFab, Google, etc.); the user can associate additional login methods with their account (more on this in the [Authentication section](/sdk/unity/wallets/embedded-wallet/onboard/authentication/federated-accounts)). If `EnableMultipleAccountsPerEmail` is enabled, users have the option to create multiple accounts per email address (associated with different login methods). While we have enabled this functionality, we, in general, feel this behaviour may be confusing to end-users and recommend integrators keep this option in the default disabled status.

<Warning>Before proceeding, please make sure you have properly configured the Embedded Wallet in the Builder. See this [guide](/solutions/builder/embedded-wallet/configuration).</Warning>

<Warning>Please double check that you have copy and pasted the configuration keys from the Builder correctly! This is the most common issue reported when integrating our SDK. If you receive an "invalid tenant" response, you have messed up your configuration! See this [guide](/solutions/builder/embedded-wallet/configuration).</Warning>
